﻿package net.wangit.adm.log;

import net.wangit.MapList;
import net.wangit.jdbc.DB;
import net.wangit.jdbc.DBFactory;
import net.wangit.support.MapListFactory;
import net.wangit.view.tree.TreeUtil;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


public class LogOrgMapListFactory implements MapListFactory {

	private static final Log log = LogFactory
			.getLog(net.wangit.adm.log.LogOrgMapListFactory.class);
	private static final String SQL_ORG = "select orgid, orgname,parentid from AORG order by o";

	public LogOrgMapListFactory() {
	}

	public MapList getMapList() {
		try {
			DB db = DBFactory.getDB();
			return TreeUtil
					.getEnumeration(
							db
									.query("select orgid, orgname,parentid from AORG order by o"),
							"&nbsp;", "orgid", "orgname", "parentid");
		} catch (Exception e) {
			log.error("create organization enumeration error", e);
			return null;
		}
	}

}
